package com.itheima.service.impl;

import com.github.pagehelper.PageHelper;
import com.itheima.dao.IPermissionDao;
import com.itheima.domain.Permission;
import com.itheima.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionServiceImpl implements IPermissionService {

    @Autowired
    private IPermissionDao permissionDao;

    /**
     * 查询所有权限信息
     *
     * @param pageNum  当前页
     * @param pageSize 每页显示条数
     * @return
     */
    @Override
    public List<Permission> findAllPermission(Integer pageNum, Integer pageSize) {
        //调用分页查询插件
        PageHelper.startPage(pageNum, pageSize);
        return permissionDao.findAllPermission();
    }

    /**
     * 添加新用户信息
     *
     * @param permission
     */
    @Override
    public void insertPermission(Permission permission) {
        permissionDao.insertPermission(permission);
    }
}
